<?php /*a:4:{s:70:"D:\laragon\www\jiaqueshop\application\manage\view\consumption_log.html";i:1598334670;s:59:"D:\laragon\www\jiaqueshop\application\manage\view\base.html";i:1596192950;s:66:"D:\laragon\www\jiaqueshop\application\manage\view\public_page.html";i:1540951044;s:62:"D:\laragon\www\jiaqueshop\application\manage\view\laypage.html";i:1540951044;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
	<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="/static/public/awesome/css/font-awesome.min.css" />

<link rel="stylesheet" href="/static/public/layui/css/layui.css" />

<link rel="stylesheet" href="/static/public/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/static/manage/css/style.css" />

	<link rel="stylesheet" href="/static/public/dist/zoomify.min.css">
	
<script src="/static/public/kindeditor/kindeditor-all.js"></script>
<script src="/static/public/kindeditor/lang/zh_CN.js"></script>
<script src="/static/public/ueditor/ueditor.config.js?t=<?php echo time();?>"></script>
<script src="/static/public/ueditor/ueditor.all.min.js"></script>
<script src="/static/public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<?php if($is_auth): ?>

<script src="/static/public/My97DatePicker/WdatePicker.js"></script>
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="<?php echo url('index/welcome'); ?>"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>系统</span>
            <span class="icon-angle-right"></span>
            <span>分销管理</span>
            <span class="icon-angle-right"></span>
            <span>分销商</span>
            <span class="icon-angle-right"></span>
            <span>消费记录</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <table class="m-table">
                <tr>
                    <th>
                        <div class="m-options cf">
                            <div class="m-search fr">
                                <form action="<?php echo url('consumptionLog'); ?>" class="layui-form" id="searchForm">
                                    <label for="">订单状态</label>
                                    <div class="lay-select m-select-tiny">
                                        <select name="order_status_id">
                                            <option value="0"<?php if($order_status_id == 0): ?> selected<?php endif; ?>>全部订单</option>
                                            <option value="1"<?php if($order_status_id == 1): ?> selected<?php endif; ?>>已取消</option>
                                            <option value="2"<?php if($order_status_id == 2): ?> selected<?php endif; ?>>未付款</option>
                                            <option value="3"<?php if($order_status_id == 3): ?> selected<?php endif; ?>>已付款</option>
                                            <option value="4"<?php if($order_status_id == 4): ?> selected<?php endif; ?>>待发货</option>
                                            <option value="5"<?php if($order_status_id == 5): ?> selected<?php endif; ?>>等收货</option>
                                            <option value="6"<?php if($order_status_id == 6): ?> selected<?php endif; ?>>已完成</option>
                                        </select>
                                    </div>
                                    <label for="keywords">下单会员</label>
                                    <input type="hidden" name="userid" value="<?php echo htmlentities($userid); ?>">
                                    <input type="text" name="keywords" id="keywords" class="u-ipt u-ipt-def" placeholder="请输入要会员" value="<?php echo htmlentities($keywords); ?>" />
                                    <label for="">下单时间</label>
                                    <input type="text" name="start_time" class="u-ipt u-ipt-small" placeholder="开始时间" value="<?php echo !empty($startTime) ? htmlentities($startTime) : ''; ?>" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly />
                                    <span>-</span>
                                    <input type="text" name="end_time" class="u-ipt u-ipt-small" placeholder="结束时间" value="<?php echo !empty($endTime) ? htmlentities($endTime) : ''; ?>" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly />
                                    <input type="submit" class="u-btn u-search" value="查看" />
                                    <input type="button" class="u-btn u-export" value="导出" />
                                </form>
                            </div>
                        </div>
                    </th>
                </tr>
            </table>
            <form class="layui-form m-list-form">
                <table class="m-table mt-10">
                    <tbody class="datas">
                    <tr>
                        <th width="5%">ID</th>
                        <th width="10%">订单编号</th>
                        <th width="10%">下单会员</th>
                        <th width="10%">支付方式</th>
                        <th width="10%">收货人</th>
                        <th width="10%">订单金额</th>
                        <th width="10%">实付金额</th>
                        <th width="10%">下单时间</th>
                        <th width="15%">订单状态</th>
                        <th width="10%">操作</th>
                    </tr>
                    <?php if(is_array($data) || $data instanceof \think\Collection || $data instanceof \think\Paginator): if( count($data)==0 ) : echo "" ;else: foreach($data as $key=>$v): ?>
                    <tr>
                        <td><?php echo htmlentities($v['id']); ?></td>
                        <td><?php echo htmlentities($v['order_no']); ?></td>
                        <td><?php echo htmlentities($v['username']); ?></td>
                        <td><?php echo htmlentities($v['pay_type_name']); ?></td>
                        <td><?php echo htmlentities($v['receiver_name']); ?></td>
                        <td><?php echo htmlentities($v['order_amount']); ?></td>
                        <td><?php echo htmlentities($v['pay_amount']); ?></td>
                        <td><?php echo htmlentities($v['create_time_date']); ?></td>
                        <td><?php echo htmlentities($v['order_status_txt']); ?></td>
                        <td class="m-opt">
<!--                            <a data-id="<?php echo htmlentities($v['id']); ?>" data-shipping-userid="<?php echo htmlentities($v['shipping_userid']); ?>" data-shipping-user="<?php echo htmlentities($v['shipping_user']); ?>" class="u-allot" title="分配订单"><i class="icon-user-md"></i></a>-->
                            <a href="<?php echo url('add', ['id' => $v['id']]); ?>" title="查看详情"><i class="icon-pencil"></i></a></td>
                    </tr>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                    </tbody>
                </table>
            </form>
            <?php if($count): ?>
<div class="m-pages mt-10">
    <div class="m-overview fl">共 <?php echo htmlentities($count); ?> 条，<?php echo htmlentities($page); ?>/<?php echo ceil($count/$limit); ?></div>
    <div class="fl" id="page"></div>
</div>
<?php endif; ?>
        </div>
    </div>
</div>

<?php endif; ?>
<input type="hidden" name="action_uri" value="<?php echo url('action'); ?>" />

<input type="hidden" name="redirect_uri" value="<?php echo url('index'); ?>" />

<input type="hidden" name="region_uri" value="/manage/regions/regions" />
<script src="/static/public/js/jquery-1.10.2.js"></script>
<script src="/static/public/js/maniac.ui.js"></script>
<script src="/static/public/layui/layui.js" charset="utf-8"></script>
<script src="/static/public/js/aes.js"></script>
<script src="/static/public/js/mode-ecb-min.js"></script>
<script src="/static/public/js/utils.js"></script>
<script src="/static/public/js/dialog.js"></script>
<script src="/static/manage/js/form.js"></script>
<script src="/static/manage/js/js.js"></script>
<script src="/static/public/js/app.js"></script>
<script src="/static/public/js/encrypt.js"></script>
<script src="/static/public/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.fdzoom').zoomify();
</script>

<script>
var aesKey = '<?php echo htmlentities($encrypt_key); ?>';
    $(function(){
        layui.use('layer', function(){
            var user_exists = parseInt('<?php echo !empty($user_exists) ? 1  :  0; ?>');
            var user_forbidden = parseInt('<?php echo !empty($user_forbidden) ? 1  :  0; ?>');
            var quit_force = parseInt('<?php echo !empty($quit_force) ? 1  :  0; ?>');
            var is_auth    = parseInt('<?php echo !empty($is_auth) ? 1  :  0; ?>');
            
            if (user_exists) {
                dialog.error('您所登录的用户已被删除', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (user_forbidden) {
                dialog.error('您的账户已被禁用', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }

            if (quit_force) {
                dialog.error('同一账户同一时间只能一人在线', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (!is_auth) {
                dialog.error('您没有权限执行此操作', function(){
                    window.location.href = history.go(-1);
                    return false;
                });
            }
        });
    })
</script>

<script>
layui.use('laypage', function(){
    var laypage = layui.laypage;

    // 执行一个laypage实例
    laypage.render({
        elem: 'page', // 注意，这里的 page 是 ID，不用加 # 号
        count: '<?php echo htmlentities($count); ?>',     // 数据总数，从服务端得到
        limit: '<?php echo htmlentities($limit); ?>',        // 每页显示的条数。laypage 将会借助 count 和 limit 计算出分页数。
        curr: '<?php echo htmlentities($page); ?>',    // 起始页。
        groups: 10,        // 连续出现的页码个数
        first: '首页',
        last: '尾页',
        prev: '<em>←</em>',
        next: '<em>→</em>',
        theme: '#337AB7',    // 自定义主题。支持传入：颜色值，或任意普通字符。
        jump: function(obj, first){
            // obj 包含了当前分页的所有参数，比如：
            // obj.curr: 得到当前页，以便向服务端请求对应页的数据。
            // obj.limit: 得到每页显示的条数
            // 首次不执行
            if (!first) {
                var href = location.href.replace(/[?|&]page=\d*/, '');
                var and  = href.indexOf('?') == -1 ? '?' : '&';
                window.location.href = href + and + 'page=' + obj.curr;
            }
        }
    });
});
</script>
<script>
    $(function(){
        layui.use('layer', function(){
            $('.u-export').click(function(){
                $('#searchForm').attr('action', '<?php echo url("export"); ?>');
                $('#searchForm').submit();
            })

            $('.u-allot').click(function(){
                var id              = $(this).attr('data-id');
                var shipping_userid = $(this).attr('data-shipping-userid');
                var shipping_user   = $(this).attr('data-shipping-user');

                layer.open({
                    type: 1,
                    title: '指定配送员',
                    skin: 'layui-layer-rim', //加上边框
                    area: ['440px', '250px'], //宽高
                    content: '<div class="m-allot"><input type="text" name="nickname" class="u-ipt u-nick" placeholder="请输入配送员的昵称" value="'+shipping_user+'" /><input type="button" name="" class="u-btn" id="j_allot" data-id="'+id+'" data-userid="'+shipping_userid+'" value="确认提交" /><div class="m-user-list"></div></div>'
                });
            });

            $('body').on('keyup', '.u-nick', function(){
                var $that = $(this);
                $.post('<?php echo url("/manage/members/search"); ?>', {nickname: $(this).val()}, function(ret){
                    if (ret) {
                        var html = '';
                        if (ret.status == 0) {
                            if (ret.data.length > 0) {
                                html += '<ul>';
                                for (var i = 0; i < ret.data.length; i++) {
                                    html += '<li><a class="u-nick-item" data-userid="'+ret.data[i].id+'">'+ret.data[i].nickname+'</a></li>';
                                }
                                html += '</ul>';
                            } else {
                                html = '<h3>暂无搜索结果</h3>';
                            }
                        } else {
                            html = '<h3>暂无搜索结果</h3>';
                        }
                        $that.next().next().html(html);
                        $that.next().next().show();
                    }
                }, 'json');
            });

            $('body').on('click', '.u-nick-item', function(){
                $(this).parent().parent().parent().prev().attr('data-userid', $(this).attr('data-userid'));
                $(this).parent().parent().parent().prev().prev().val($(this).text());
                $(this).parent().parent().parent().hide();
            });

            $('body').on('click', '#j_allot', function(){
                var id     = $(this).attr('data-id');
                var userid = $(this).attr('data-userid');
                $.post('<?php echo url("allot"); ?>', {id: id, userid: userid}, function(ret){
                    if (ret.status == 0) {
                        dialog.success(ret.message, function(){
                            layer.closeAll();
                            window.location.reload();
                        });
                    } else {
                        dialog.error(ret.message);
                    }
                }, 'json');
            });
        })
    })
</script>

</body>
</html>